import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

  const routes = [
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[{
      path:'/recruit',
      name:'Recruit',
      component:()=>import('../views/recruit.vue')
    },
    {
      path:'/examine',
      name:'Examine',
      component:()=>import('../views/examine.vue')
    },
    {
      path:'/personal',
      name:'Personal',
      component:()=>import('../views/personal.vue')
    },
    {
      path:'/cpassword',
      name:'Cpassword',
      component:()=>import('../views/cpassword.vue')
    },
    {
      path:'/roleOperation',
      name:'RoleOperation',
      component:()=>import('../views/roleOperation.vue')
    },
    {
      path:'/assignRoles',
      name:'AssignRoles',
      component:()=>import('../views/assignRoles.vue')
    }
  ]
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path:'/login',
    name:'Login',
    component:()=>import('../views/login.vue')
  },
  {
    path:"",
    redirect: "/login",
    component: () => import( '../views/login.vue')
    // 重定向 一进入就是登陆页面
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
